#include <iostream>

class calculation // 抽象类:具有纯虚函数的类  接口类
// 抽象类不能实列化
{
public:
    virtual int calculate(int a,int b) = 0; //纯虚函数
};

//继承自抽象类的类仍然是抽象类，只有重新纯虚函数才可以实列化
class Add : public calculation
{
public:
    virtual int calculate(int a,int b)
    {
        return a + b;
    }
};

class Mius : public calculation
{
public:
    virtual int calculate(int a,int b)
    {
        return a + b;
    }
};

class Mutiply : public calculation
{
public:
    virtual int calculate(int a,int b)
    {
        return a * b;
    }
};

class Devide : public calculation
{
public:
    virtual int calculate(int a,int b)
    {
        return a / b;
    }
};

void calculate(calculation *c,int a,int b)
{
    std::cout<<c->calculate(a,b)<<std::endl;
}

int main()
{
    calculate(new Add,1,2);
    return 0;
}